import { dropdown_Map } from "@/enums/common.js";
import { ref, computed } from "vue";
import api from "@/api/index";

// 课程类型
const getCategory = ()=>{
	const options = []
	api.public.getCategory.get().then(res => {
		if (res.code == 200) {
			res.data.forEach(item => {
				options.push({
					value: item.id,
					label: item.name
				})
			})
		}
	})
	return options
}

const classifyOption = ref([])
const categoryId = ref(null)
// 学科分类
const getClassify = computed(()=>{
	const options = []
	if (categoryId.value) {
		api.public.getClassify.get().then(res => {
			if (res.code == 200) {
				res.data.forEach(item => {
					options.push({
						value: item.id,
						label: item.name
					})
				})
			}
		})
	}
	return options
})

export const formColumn = [
	{
		component: "el-select",
		label: "授课地点",
		prop: "schoolId",
		options: dropdown_Map(),
	},
	// {
	// 	label: "课程类型",
	// 	prop: "courseType",
	// 	component: 'el-select',
	// 	options: getCategory(),
	// 	on: {
	// 		change: (val) => {
	// 			categoryId.value = val
	// 		}
	// 	}
	// },
	// {
	// 	label: "学科分类",
	// 	prop: "classifyId",
	// 	component: 'el-cascader',
	// 	options: getClassify
	// },
	{
		component: "el-input",
		label: "课程名称",
		prop: "courseName",
	},
	{
		component: "el-select",
		label: "课程状态",
		prop: "state",
		options: [
			{
				label: "启用",
				value: 1,
			},
			{
				label: "停用",
				value: 0,
			},
		]
	},
]
export const column = [
	{
		label: "授课地点",
		prop: "schoolName",
		width: "180",
	},
	{
		label: "课程名称",
		prop: "courseName",
		width: "180",
	},
	{
		label: "课程类型",
		prop: "courseType",
		width: "150",
	},
	{
		label: "学科分类",
		prop: "courseClassify",
		width: "150",
	},
	{
		label: "课程状态",
		prop: "state",
		width: "150",
	},
	{
		label: "上课课次",
		prop: "times",
		width: "150",
	},
	{
		label: "每次课时",
		prop: "period",
		width: "150",
	},
	// {
	// 	label: "课程时长(分钟)",
	// 	prop: "schedule",
	// 	width: "150",
	// },
	{
		label: "课程原价",
		prop: "price",
		width: "150",
	},
	{
		label: "报名价格",
		prop: "nowPrice",
		width: "150",
	},
	{
		label: "工具费用",
		prop: "toolCost",
		width: "150",
	},
	{
		label: "工具",
		prop: "tool",
		width: "150",
	},
	{
		label: "有效期",
		prop: "indate",
		width: "150",
	},
	// {
	// 	label: "有效期截至时间",
	// 	prop: "byIndate",
	// 	width: "150",
	// },
	{
		label: "操作人",
		prop: "creator",
		width: "150",
	},
	{
		label: "操作时间",
		prop: "createTime",
		width: "150",
	},
	{
		label: "课程人数",
		prop: "studentNum",
		width: "150",
	},
];
